package edu.lingnan.ns_ebusiness.service.impl;

import edu.lingnan.ns_ebusiness.pojo.TbFocus;
import edu.lingnan.ns_ebusiness.mapper.TbFocusMapper;
import edu.lingnan.ns_ebusiness.pojo.TbGoodstable;
import edu.lingnan.ns_ebusiness.pojo.TbUser;
import edu.lingnan.ns_ebusiness.service.TbFocusService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 陈世杰
 * @since 2022-01-04
 */
@Service
public class TbFocusServiceImpl extends ServiceImpl<TbFocusMapper, TbFocus> implements TbFocusService {
    @Autowired(required = false)
    private TbFocusMapper focusMapper;
    @Override
    public String getMyFocusGoodsInfo(HttpSession httpSession, Model model) {
//        TbUser user=(TbUser)httpSession.getAttribute("user");
//        if(user==null){
//            throw new RuntimeException("用户数据不存在");
//        }
        List<TbGoodstable> focusList =
//                focusMapper.getMyFocusGoodsInfo(user.getUserId());
                focusMapper.getMyFocusGoodsInfo(2);
        for(TbGoodstable goods:focusList){
            System.out.println(goods);
        }
        model.addAttribute("focusList",focusList);
        return "shop-wishlist";
    }
}
